feat: customise html styles#1567
Conversation
d208a58 to
1f4847a
Compare
| import 'dart:convert'; | ||
|
|
||
| import 'package:cached_network_image/cached_network_image.dart'; | ||
| import 'package:collection/collection.dart'; |
There was a problem hiding this comment.
I am fine with adding another package, but I think there is a simpler solution that helps us override the default values: https://stackoverflow.com/a/71992310/9138914
There was a problem hiding this comment.
So using rest operators won't work as it will completely replace the value for a given key. So if we have a default style for h1 and a custom style comes in for h1 then the whole default style is lost for h1. But we don't want that as we want the styles to be merged if present in both places.
I can replace it with my own code to compare and merge the styles if we don't want to add in another package but I believe this package will help us in the long run as it has many helper functions for working with collections and it's an official package by dart devs.
Here's an example
void main() {
print({
...{
'a': {'aa': 1, 'ab': 2},
'b': {'ba': 3},
},
...{'a': {'ac': 5}},
});
}The output will be: {a: {ac: 5}, b: {ba: 3}}
1f4847a to
a162dfd
Compare
Co-authored-by: Sem Bauke <semboot699@gmail.com>
Checklist:
mainbranch of the repo.Instead of adding new variables when we want to customise the html styles, I updated the parser to accept custom styles and merge them with default ones.